#include "pluginlogin.h"
#include "ui_pluginlogin.h"
#include "binarystreamwriter.h"
#include "ciusocket.h"
#include "Msg.h"
#include "IUProtocolData.h"
#include <string.h>

#include <QDebug>


PluginLogin::PluginLogin(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::PluginLogin)
{
    ui->setupUi(this);
   // m_pUISocket = new CIUSocket();
}

PluginLogin::~PluginLogin()
{
    delete ui;
}

void PluginLogin::on_pushButton_clicked()
{
    char szUser[64] = { 0 };
    QString strUseName = ui->lineEdit_name->text();
    QString strPassWord = ui->lineEdit_Pass->text();
    memcpy(szUser,strUseName.toStdString().c_str(), strUseName.toStdString().size());
    char szPassword[64] = {0};
    memcpy(szPassword,strPassWord.toStdString().c_str(), strPassWord.toStdString().size());

    std::string strReturnData;
    bool bRet = CIUSocket::GetInstance().Login(szUser, szPassword, 1, online_type_pc_online, 3, strReturnData);
    int nRet = LOGIN_FAILED;
    if(bRet == false) {
        qDebug()<<"bRet == false"  ;
    } else {
        qDebug()<<"bRet == true"  ;
    }
}
